package ru.javadevelop.homefinans.svc;

import com.neurospeech.wsclient.*;
import org.w3c.dom.*;

import java.math.BigDecimal;

public class Cost extends WSObject
{
	
	private String _CategoryId;
	public String getCategoryId(){
		return _CategoryId;
	}
	public void setCategoryId(String value){
		_CategoryId = value;
	}
	private String _Id;
	public String getId(){
		return _Id;
	}
	public void setId(String value){
		_Id = value;
	}
	private Long _LongDate;
	public Long getLongDate(){
		return _LongDate;
	}
	public void setLongDate(Long value){
		_LongDate = value;
	}
	private BigDecimal _Sum;
	public BigDecimal getSum(){
		return _Sum;
	}
	public void setSum(BigDecimal value){
		_Sum = value;
	}
	private String _Username;
	public String getUsername(){
		return _Username;
	}
	public void setUsername(String value){
		_Username = value;
	}
	
	public static Cost loadFrom(Element root) throws Exception
	{
		if(WSHelper.isNull(root)){
			return null;
		}
		Cost result = new Cost();
		result.load(root);
		return result;
	}
	
	
	protected void load(Element root) throws Exception
	{
		this.setCategoryId(WSHelper.getString(root,"CategoryId",false));
		this.setId(WSHelper.getString(root,"Id",false));
		this.setLongDate(WSHelper.getLong(root,"LongDate",false));
		this.setSum(BigDecimal.valueOf(WSHelper.getDouble(root,"Sum",false)));
		this.setUsername(WSHelper.getString(root,"Username",false));
	}
	
	
	
	public Element toXMLElement(WSHelper ws, Element root)
	{
		Element e = ws.createElement("ns4:Cost");
		fillXML(ws,e);
		return e;
	}
	
	public void fillXML(WSHelper ws,Element e)
	{
		ws.addChild(e,"ns4:CategoryId",String.valueOf(_CategoryId),false);
		ws.addChild(e,"ns4:Id",String.valueOf(_Id),false);
		ws.addChild(e,"ns4:LongDate",String.valueOf(_LongDate),false);
		ws.addChild(e,"ns4:Sum",String.valueOf(_Sum),false);
		ws.addChild(e,"ns4:Username",String.valueOf(_Username),false);
	}
	
}
